package com.tbl.gamecaro;

import android.app.Activity;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;

public class Splash extends Activity {
	android.widget.ImageView loading;
	android.widget.ImageButton button;
	android.widget.TextView txt1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        
        thamChieu();
        
        button.setVisibility(android.view.View.INVISIBLE);
        new CountDownTimer(5000,1000) {
        	int counter = 5;
			@Override
			public void onTick(long millisUntilFinished) {
				// TODO Auto-generated method stub
				counter--;
				txt1.setText("( "+counter+" )");
			}
			
			@Override
			public void onFinish() {
				// TODO Auto-generated method stub
				loading.setVisibility(android.view.View.INVISIBLE);
				txt1.setVisibility(android.view.View.INVISIBLE);
				button.setVisibility(android.view.View.VISIBLE);
				
			}
		}.start();
		
		button.setOnClickListener(new OnClickListener() {
			
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				android.content.Intent intent = new android.content.Intent(getApplicationContext(),PlayGame.class);
				startActivity(intent);
			}
		});
    }

    public void thamChieu(){
    	loading = (android.widget.ImageView)findViewById(R.id.imageView3);
    	button = (android.widget.ImageButton)findViewById(R.id.imageButton1);
    	txt1 = (android.widget.TextView)findViewById(R.id.textView1);
    }
    
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_splash, menu);
        return true;
    }

    
}
